package org.ecloud.oauth.client.service;

import org.ecloud.core.entity.APIResult;
import org.ecloud.oauth.constants.ParameterKey;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "${authorization.gateway-service-id}", fallback = ContextOrgFallback.class)
public interface ContextOrgService {

	@RequestMapping(value = "${authorization.context-org-url}", method = RequestMethod.POST)
	public APIResult<String> context(@RequestHeader(ParameterKey.HEADER_CONTEXT) String ctx, 
			@RequestHeader(ParameterKey.HEADER_AUTHORIZATION) String token, 
			@RequestParam(name = "username", required = true) String username);
	
}
